/**
 * 
 */
package com.redside.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.redside.model.lookup.NoteTypeLkp;

/**
 * @author PCHAPMAN
 * 
 */
@Entity
@Table(name = "note")
public class Note extends BaseObject implements java.io.Serializable {

    private static final long serialVersionUID = 2250916269027002398L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
    
    @ManyToOne
    @JoinColumn(name = "note_type_id", nullable = false)
    private NoteTypeLkp noteTypeLkp;
    
    @Column(name = "note", length = 250)
    private String note = "";
    
    @ManyToOne
    @JoinColumn(name = "complaint_id")
    private Complaint complaint;

    public Note() {

    }

    public Note(Date timeStamp, NoteTypeLkp noteTypeLkp, 
    		String note, Complaint complaint) {
        super();
        this.timeStamp = timeStamp;
        this.noteTypeLkp = noteTypeLkp;
        this.note = note;
        this.complaint=complaint;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the timeStamp
     */
    public Date getTimeStamp() {
        return timeStamp;
    }

    /**
     * @param timeStamp the timeStamp to set
     */
    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
    }

    /**
     * @return the noteTypeLkp
     */
    public NoteTypeLkp getNoteTypeLkp() {
        return noteTypeLkp;
    }

    /**
     * @param noteTypeLkp the noteTypeLkp to set
     */
    public void setNoteTypeLkp(NoteTypeLkp noteTypeLkp) {
        this.noteTypeLkp = noteTypeLkp;
    }

    /**
	 * @return the note
	 */
	public String getNote() {
		return note;
	}

	/**
	 * @param note the note to set
	 */
	public void setNote(String note) {
		this.note = note;
	}
	
	/**
	 * @return the complaint
	 */
	public Complaint getComplaint() {
		return complaint;
	}

	/**
	 * @param complaint the complaint to set
	 */
	public void setComplaint(Complaint complaint) {
		this.complaint = complaint;
	}

	/**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof Note)) {
            return false;
        }
        Note rhs = (Note) object;
        return new EqualsBuilder().append(this.id,
                rhs.id).append(this.noteTypeLkp, rhs.noteTypeLkp).append(this.timeStamp,
                rhs.timeStamp).append(this.note, rhs.note).isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(258075367, 1978977653).append(this.id).append(this.noteTypeLkp).append(this.timeStamp).append(
                        this.note).toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this).append("noteTypeLkp", this.noteTypeLkp).append(
                "timeStamp", this.timeStamp).append("notes", this.note).append("id",
                this.id).toString();
    }

 
}
